package com.karolak.workstation.product;

import java.util.List;

import com.karolak.workstation.Task;

public class ProductProcessor {

	private List<Task> tasks;

	// === life cycle api === //
	protected void init() {

	}

	protected void initTasks() {
		for (Task task : getTasks()) {
			task.init();
		}
	}

	// === product life cycle api === //
	public void readProductId() {

	}

	public void validateProductId() {

	}

	public void startProduct() {
		initTasks();
	}

	public boolean isTasksFinished() {
		for (Task task : getTasks()) {
			if (!task.isFinished()) {
				return false;
			}
		}
		return true;
	}

	// === tasks executing === //
	public void finishProduct() {

		// 
	}

	// === get/set === //
	public List<Task> getTasks() {
		return tasks;
	}

	protected void setTasks(List<Task> tasks) {
		this.tasks = tasks;
	}
}
